﻿using DFGK_WMS.Model.DTO;
using DFGK_WMS.Model.Models;
using DFGK_WMS.Model.NoNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK_WMS.IRepository
{
    public interface ITStocktakingOrderRepository: IBaseRepository<TStocktakingOrder>
    {
        /// <summary>
        /// 导出盘点单号
        /// </summary>
        /// <returns></returns>
        List<TStocktakingOrder> GetStockingExcel();

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        bool AddStocktakingOrder(TStocktakingOrderDto dto,out string message);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        bool UpdateStocktakingOrder(TStocktakingOrderDto dto,out string message);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        bool DelStocktakingOrder(int ids);

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="aid"></param>
        /// <param name="name"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<TStocktakingDto> GetStocktakingOrders(string? StartTime, string? EndTime, string ?OrderSn, int? StocktakingEndStatus, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        TStocktakingOrderDto GetStocktakingOrder(int ids);

        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool UpdTStocktakingOrderState(ReceivingOrderDetailDto m,out string message);

        /// <summary>
        /// 提交（有网）
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool UpTSocktakingStatus(TStocktakingOrderDetail m, out string message);

        /// <summary>
        /// 获取状态为2的盘点单
        /// </summary>
        /// <returns></returns>
        List<string> GetStocktakingList();

        /// <summary>
        /// 根据单号查询详情
        /// </summary>
        /// <param name="orderSn"></param>
        /// <returns></returns>
        List<TStocktakingOrderDetail> GetStocktakingDetailList(string orderSn);

        /// <summary>
        /// 根据库房库区查询库存表
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="aid"></param>
        /// <param name="name"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<TInventory> GetWhArList(int? id, string? name, string? startTime ,string? endTime , int? type, int pageIndex,int pageSize,out int totalCount);


        /// <summary>
        /// 往sqlite数据库插入数据
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool AddSqliteDetail(TStocktakingOrderDto m, out string message);


        /// <summary>
        /// 提交按钮
        /// </summary>
        /// <returns></returns>
        bool  SubmitTStocktaking(out string message);


        

        /// <summary>
        /// 根据OrderSn查询数据
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <returns></returns>
        List<TStocktakingOrderDto> GetStocktakingByOrderSn(string OrderSn);



        /// <summary>
        /// 盘点编辑回显接口
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <returns></returns>
        List<TStocktakingOrderDetailDto> GetTStocktakingOrderDetails(string OrderSn);

        /// <summary>
        /// 修改盘点凭证
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <param name="MaterialCode"></param>
        /// <param name="FileUrl"></param>
        /// <returns></returns>
        bool UpdStocktakingFileUrl(string OrderSn,string MaterialCode,string FileUrl);


        /// <summary>
        /// 查看盘点凭证
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <param name="MaterialCode"></param>
        /// <returns></returns>
        string GetStocktakingFileUrl(string OrderSn, string MaterialCode);
    }
}
